package Vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javax.swing.ButtonGroup;
import javax.swing.ComboBoxModel;
import javax.swing.DebugGraphics;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDesktopPane;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSpinner;
import javax.swing.JSplitPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JToggleButton;
import javax.swing.ListModel;
import javax.swing.SpinnerListModel;

import javax.swing.WindowConstants;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class VentanaGenerarCompetencia extends javax.swing.JFrame {
	
	private static final String[] TIPO_SEXO = {"Femenino", "Masculino"};
	private static final String []TIPO_FECHA = {"07/12/2011", "08/12/2011", "09/12/2011", "10/12/2011"};
	private static final String[] TIPO_MODALIDAD = {"Libre-50Mts", "Libre-100Mts","Pecho-50Mts", "Pecho-100Mts","Espalda-50Mts", "Espalda-100Mts","Mariposa-50Mts", "Mariposa-100Mts"};
	private JLabel JblTitulo;
	private JLabel JblModalidad;
	private JTable tblListado;

	private JLabel JlbSexo;
	private JScrollPane scpListado;
	private JPanel PanContenedor;
	private JLabel LblFecha;
	private JButton Btt;
	private JComboBox CmbSexo;
	private JComboBox CmbModalidadEstilo;
	private JComboBox CmbFecha;
	

	public VentanaGenerarCompetencia() {
		super();
		initGUI();
	}
	
	//private void initGUI() {
		private void initGUI() {
			try {
				setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
				getContentPane().setLayout(null);
				{
					PanContenedor = new JPanel();
					getContentPane().add(PanContenedor, "CENTER");
					PanContenedor.setLayout(null);
					PanContenedor.setBounds(19, 270, 395, 159);
					{
		/*try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);*/
						
				JblTitulo = new JLabel();
				getContentPane().add(JblTitulo);
				getContentPane().add(getCmbFecha());
				getContentPane().add(getCmbModalidadEstilo());
				getContentPane().add(getCmbSexo());
				getContentPane().add(getBtt());
				getContentPane().add(getLblFecha());
				getContentPane().add(getJblModalidad());
				getContentPane().add(getJlbSexo(), "Center");
				//getContentPane().add(getContentPane());

				//getContentPane().add(getPanContenedor());

				JblTitulo.setText("Generar Competencia");
				JblTitulo.setBounds(51, 12, 345, 33);
				JblTitulo.setFont(new java.awt.Font("Century Schoolbook L",0,28));
				JblTitulo.setForeground(new java.awt.Color(0,0,255));
					

				scpListado = new JScrollPane();
				PanContenedor.add(scpListado);
				scpListado.setBounds(54, 58, 359, 188);
				{
					tblListado = new JTable();
					scpListado.setViewportView(tblListado);
				}
			
					}
			pack();
			this.setSize(547, 509);
				}
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	

	
	private JComboBox getCmbFecha() {
		if(CmbFecha == null) {
			ComboBoxModel CmbFechaModel = 
				new DefaultComboBoxModel(TIPO_FECHA);
						//new String[] { "Item One", "Item Two" });
			CmbFecha = new JComboBox();
			CmbFecha.setModel(CmbFechaModel);
			CmbFecha.setBounds(227, 67, 122, 22);
		}
		return CmbFecha;
	}
	
	private JComboBox getCmbModalidadEstilo() {
		if(CmbModalidadEstilo == null) {
			ComboBoxModel CmbModalidadEstiloModel = 
				new DefaultComboBoxModel(TIPO_MODALIDAD);
						//new String[] { "Item One", "Item Two" });
			CmbModalidadEstilo = new JComboBox();
			CmbModalidadEstilo.setModel(CmbModalidadEstiloModel);
			CmbModalidadEstilo.setBounds(227, 104, 122, 22);
		}
		return CmbModalidadEstilo;
	}
	
	private JComboBox getCmbSexo() {
		if(CmbSexo == null) {
			ComboBoxModel CmbSexoModel = 
				new DefaultComboBoxModel(TIPO_SEXO);
			CmbSexo = new JComboBox();
			CmbSexo.setModel(CmbSexoModel);
			CmbSexo.setBounds(227, 145, 122, 22);
		}
		return CmbSexo;
	}
	
	private JButton getBtt() {
		if(Btt == null) {
			Btt = new JButton();
			Btt.setText("Generar");
			Btt.setBounds(165, 194, 100, 22);
			Btt.setActionCommand("Generar");
		}
		return Btt;
	}
	
	public void agregarListener(ActionListener listener){
		Btt.addActionListener(listener);
	}
	
	private JLabel getLblFecha() {
		if(LblFecha == null) {
			LblFecha = new JLabel();
			LblFecha.setText("Por Fecha:");
			LblFecha.setBounds(67, 71, 86, 15);
		}
		return LblFecha;
	}
	
	private JLabel getJblModalidad() {
		if(JblModalidad == null) {
			JblModalidad = new JLabel();
			JblModalidad.setText("Por Modalidad/Estilo: ");
			JblModalidad.setBounds(67, 108, 135, 15);
		}
		return JblModalidad;
	}
	
	private JLabel getJlbSexo() {
		if(JlbSexo == null) {
			JlbSexo = new JLabel();
			JlbSexo.setText("Sexo: ");
			JlbSexo.setBounds(72, 151, 41, 23);
		}
		return JlbSexo;
	}

	public void setListado(AbstractTableModel abstractTableModel){
		tblListado.setModel(abstractTableModel);
	}
		
	public JComboBox getModalidad()
	{ 
		return CmbModalidadEstilo;
	}
	
	public void mostrarMensaje(String mensaje){
		JOptionPane.showMessageDialog(this, mensaje);
	}
	
	
	
	
	/*
	private JPanel getPanContenedor() {
		if(PanContenedor == null) {
			PanContenedor = new JPanel();
			PanContenedor.setBounds(19, 270, 395, 159);
			PanContenedor.add(getScpListado());
		}
		return PanContenedor;
	}
	
	private JScrollPane getScpListado() {
		if(scpListado == null) {
			scpListado = new JScrollPane();
			scpListado.setPreferredSize(new java.awt.Dimension(353, 147));
			scpListado.setViewportView(getTblListado());
		}
		return scpListado;
	}
	
	private JTable getTblListado() {
		if(tblListado == null) {
			TableModel tblListadoModel = 
					new DefaultTableModel(
							new String[][] { { "One", "Two" }, { "Three", "Four" } },
							new String[] { "Column 1", "Column 2" });
			tblListado = new JTable();
			tblListado.setModel(tblListadoModel);
		}
		return tblListado;
	}
*/
}
